package io.esirong.eye;

import android.app.Activity;
import android.app.Dialog;

import androidx.fragment.app.Fragment;

/**
 * 页面场景进入离开记录调度
 * Created by 黄嵘才(HuangRc) on 2019/10/8.
 */
public class Screen {

    /** 当前进入场景/页面 */
    private String currentEnterView;
    /** 当前离开场景/页面 */
    private String currentLeaveView;

    /** 当前页面进入 */
    public void onEnter(Activity activity) {
        currentEnterView = activity.getClass().getName();
        Event event = EventManager.createLeaveEvent(currentLeaveView, currentEnterView);
        report(event);
    }

    /** 当前页面离开 */
    public void onLeave(Activity activity) {
        currentLeaveView = activity.getClass().getName();
    }

    /** 当前页面进入 */
    public void onEnter(Fragment fragment) {
        currentEnterView = fragment.getClass().getName();
    }

    /** 当前页面离开 */
    public void onLeave(Fragment fragment) {
        currentLeaveView = fragment.getClass().getName();
    }

    /** 当前页面进入 */
    public void onEnter(Dialog dialog) {
        currentEnterView = dialog.getClass().getName();
    }

    /** 当前页面离开 */
    public void onLeave(Dialog dialog) {
        currentLeaveView = dialog.getClass().getName();
    }

    /** 报告 */
    private void report(Event event) {
    }
}
